package com.example.mymnue;

import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import androidx.recyclerview.widget.RecyclerView;

import android.app.Activity;
import android.app.ListActivity;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.ListView;
import android.widget.SimpleAdapter;
import android.widget.Toast;

import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
import org.jsoup.select.Elements;

import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;

public class MainActivity extends AppCompatActivity implements View.OnClickListener {
    Intent intent;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

    }

    @Override
    public void onClick(View v) {
        switch (v.getId()) {
            case R.id.textView6:
                intent = new Intent(MainActivity.this, DishActivity.class);
                intent.putExtra("dish","https://home.meishichina.com/recipe/recai/hot/");
                startActivity(intent);
                break;
            case R.id.textView7:
                intent = new Intent(MainActivity.this, DishActivity.class);
                intent.putExtra("dish","https://home.meishichina.com/recipe/liangcai/hot/");
                startActivity(intent);
                break;
            case R.id.textView8:
                intent = new Intent(MainActivity.this, DishActivity.class);
                intent.putExtra("dish","https://home.meishichina.com/recipe/tanggeng/hot/");
                startActivity(intent);
                break;
            case R.id.textView9:
                intent = new Intent(MainActivity.this, DishActivity.class);
                intent.putExtra("dish","https://home.meishichina.com/recipe/zhushi/hot/");
                startActivity(intent);
                break;
            case R.id.textView10:
                intent = new Intent(MainActivity.this, DishActivity.class);
                intent.putExtra("dish","https://home.meishichina.com/recipe/xiaochi/hot/");
                startActivity(intent);
                break;
            case R.id.textView11:
                intent = new Intent(MainActivity.this, DishActivity.class);
                intent.putExtra("dish","https://home.meishichina.com/recipe/hongbei/hot/");
                startActivity(intent);
                break;
            case R.id.textView12:
                intent=new Intent(MainActivity.this,DishActivity.class);
                intent.putExtra("dish","https://home.meishichina.com/recipe/yinpin/hot/");
                startActivity(intent);
                break;
        }
    }
    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        getMenuInflater().inflate(R.menu.menu,menu);
        return true;
    }
    public boolean onOptionsItemSelected(MenuItem item){
        switch (item.getItemId()){
            case R.id.shop:
               Intent intent1=new Intent(MainActivity.this,ShopActivity.class);
               startActivity(intent1);
                break;
            case R.id.history:
                Intent intent2 =new Intent(MainActivity.this,HistoryActivity.class);
                startActivity(intent2);
                break;
        }
        return super.onOptionsItemSelected(item);
    }


}